package com.smarttiger.zero.admin.entity;

import javax.persistence.*;
import java.util.List;

@Entity
@Table(name = "dictionary")
public class DictionaryModel extends BaseEntity {


    @Column(name = "code",length = 20)
    private String code;

    @Column(name = "label",length = 100)
    private String label;


    @OneToMany(cascade = CascadeType.REMOVE, fetch = FetchType.LAZY)
    @JoinColumn(name = "parentCode",referencedColumnName="code",nullable = false,insertable=false, updatable=false)
    private List<DictionaryDetailModel> dictionaryModels;

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public List<DictionaryDetailModel> getDictionaryModels() {
        return dictionaryModels;
    }

    public void setDictionaryModels(List<DictionaryDetailModel> dictionaryModels) {
        this.dictionaryModels = dictionaryModels;
    }
}
